package com.timothy.android;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.GridView;

public class OfflineButtonAdapter extends BaseAdapter {
	private Context mContext = null;

	   // references to our images
    private List<Button> btnList = new ArrayList<Button>();
    
    public OfflineButtonAdapter(Context c) {
        mContext = c;
        for(int i=0;i<100;i++){
        	Button btn = new Button(c);
        	btn.setText("Q"+String.valueOf(i));
        	btn.setBackgroundColor(Color.YELLOW);
    		btnList.add(btn);
    	}
    }
    
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return btnList.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		Button button;
        if (convertView == null) {  // if it's not recycled, initialize some attributes
            button = new Button(mContext);
            button.setLayoutParams(new GridView.LayoutParams(85, 85));
//            imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
            button.setPadding(2,2,2,2);
        } else {
            button = (Button) convertView;
        }

        button = btnList.get(position);
//        button.setImageResource(mThumbIds[position]);
        return button;
	}

}
